<template>
  <div class="container">
    <span class="particle" v-for="i in 40">4</span>
    <span class="particle" v-for="i in 40">0</span>
    <article class="content">
      <p>亲爱的 <span class="username">${username}</span></p>
      <p>您得到了一个 <strong>404</strong> 页面.</p>
      <p>
        <button @click="returnUrl">Go Back</button>
      </p>
    </article>
  </div>
</template>

<script setup lang="ts">
import { useRoute, useRouter } from "vue-router";
const route = useRoute();
const router = useRouter();
function returnUrl() {
  router.back()
}
</script>

<style lang="scss">
$val: floatReverse, float1, floatReverse1, float2, floatReverse2;
@function randomList($list) {
  @return nth($list, random(length($list)));
}
* {
  box-sizing: border-box;
}

.container {
  margin: 0;
  font-size: 15px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: white;
  color: black;
  font-family: "楷体", "楷体_GB2312";
  overflow: hidden;
  .username {
    color: #812a21;
    font-size: 20px;
  }
  .content {
    position: relative;
    width: 600px;
    max-width: 100%;
    margin: 20px;
    background: white;
    padding: 60px 40px;
    text-align: center;
    box-shadow: -10px 10px 67px -12px rgba(0, 0, 0, 0.2);
    opacity: 0;
    animation: apparition 0.8s 1.2s cubic-bezier(0.39, 0.575, 0.28, 0.995)
      forwards;
    p {
      font-size: 1.3rem;
      margin-top: 0;
      margin-bottom: 0.6rem;
      letter-spacing: 0.1rem;
      color: #595959;
    }
    p:last-child {
      margin-bottom: 0;
    }
    button {
      display: inline-block;
      margin-top: 2rem;
      padding: 0.5rem 1rem;
      border: 3px solid #595959;
      background: transparent;
      font-size: 1rem;
      color: #595959;
      text-decoration: none;
      cursor: pointer;
      font-weight: bold;
    }
  }
  .particle {
    position: absolute;
    display: block;
    pointer-events: none;
  }
  @for $i from 1 to 81 {
    .particle:nth-child(#{$i}) {
      top: random() * 100%;
      left: random() * 100%;
      font-size: (random(10) + 15) + px;
      filter: blur(0.02 * $i + px);
      animation: (random() + 5) + s randomList($val) infinite;
    }
  }
}
@keyframes apparition {
  from {
    opacity: 0;
    transform: translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes float1 {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(180px);
  }
}
@keyframes floatReverse1 {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-180px);
  }
}
@keyframes float2 {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(28px);
  }
}
@keyframes floatReverse2 {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-28px);
  }
}
</style>